package com.peanut.mapper;

import com.orm.annotation.Select;
import com.orm.mapper.BaseMapper;
import com.peanut.entity.ChannelType;
import com.peanut.entity.vo.ChannelTypeVO;

import java.util.List;

public interface ChannelTypeMapper extends BaseMapper<ChannelType> {
	
	// 只查一级类型
	@Select("select * from channel_type where parent_id is null")
	List<ChannelTypeVO> queryTopType();
	
	// 只查二级类型
	@Select("select * from channel_type where parent_id is not null")
	List<ChannelTypeVO.ChannelTypeSonVO> querySonType();
	
	
	// 查一下该类型下面有没有子类型,取啥名好呢？
	@Select("select count(1) from channel_type where parent_id = #{id}")
	int query1(int id);
	
	// 查一下该类型有没有被 渠道表使用
	@Select("select count(1) from channel where type_id = #{id}")
	int query2(int id);
	
}
